package com.my.screenadapter.Base;

import android.content.Context;

import java.util.List;

/**
 * Created by 张英杰 on 2016/11/16.
 */

public abstract class CommonAdapter<T> extends MultiItemTypeAdapter<T> {
    public CommonAdapter(Context mContext, final int layoutId,List mDatas) {
        super(mContext, mDatas);
        addItemViewDelegate(new ItemViewDelegate<T>()
        {
            @Override
            public int getItemViewLayoutId()
            {
                return layoutId;
            }

            @Override
            public boolean isForViewType(T item, int position)
            {
                return true;
            }

            @Override
            public void convert(ViewHolder holder, T t, int position)
            {
                CommonAdapter.this.convert(holder, t, position);
            }
        });
    }
    protected abstract void convert(ViewHolder viewHolder, T item, int position);
}
